<template>
  <div class="reportFormPage">
    <div id="domid" class="report-dom">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">水泥混凝土坍落度、表观密度试验检测记录表</div>
        <div class="codeText">BGLQ05002F</div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>记录编号：</span>
          <span class="placeholder">{{ form.jilbh }}</span>
        </div>
      </div>
      <!-- .........................1111111111111111111111111111111......................................................... -->
      <div class="table-border">
        <table height="220px" class="top-table">
          <tbody>
            <tr>
              <td align="center" width="15%" height="25">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程部位/用途</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验日期</span>
              </td>
               <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>

              <td align="center" style="width: 15%">
                <span style="width: 90px; display: inline-block">试验条件</span>
              </td>
              <td v-if="isPdf" width="35%">
                温度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                ℃；湿度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span
                >%RH
              </td>
              <td v-else width="35%">
                温度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.wend" class="height100" style="width: 15%" />℃；湿度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.xiangdsd" class="height100" style="width: 15%" />%RH
              </td>
            </tr>
            <tr>
              <td height="50" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="50" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="616px" class="middle-table">
          <tbody>
            <tr>
              <td height="30" colspan="2" width="15%">混凝土种类</td>
              <td colspan="4">
                <el-input type="text" v-model="form.hunntzl" @keydown.native="handleKeyDown($event, 0, 0)" :ref="'0_0'" />
              </td>
              <td align="center" height="30" colspan="2">搅拌方式</td>
              <td colspan="3">
                <!-- <el-input type="text" v-model="form.jiaobfs" @keydown.native="handleKeyDown($event, 0, 1)" :ref="'0_1'" /> -->
                <el-select clearable v-model="form.jiaobfs" class="hide-icon width100 height100" placeholder>
                  <el-option label="强制式" value="强制式"></el-option>
                  <el-option label="机械拌制" value="机械拌制"></el-option>
                  <el-option label="人工拌制" value="人工拌制"></el-option>
                </el-select>
              </td>
            </tr>
            <tr trindex="0">
              <td width="100%" colspan="11" height="30">拌和物坍落度</td>
            </tr>
            <tr trindex="1">
              <td style="width: 8%" rowspan="2">试样编号</td>
              <td colspan="3">坍落度测值(mm)</td>
              <td colspan="3">扩展度测定值(mm)</td>
              <td colspan="4">拌和物性质评定</td>
            </tr>
            <tr trindex="1">
              <td width="8%">1</td>
              <td width="8%">2</td>
              <td>平均值</td>
              <td width="8%">1</td>
              <td width="8%">2</td>
              <td>平均值</td>
              <td>保水性</td>
              <td>含砂情况</td>
              <td>粘聚性</td>
              <td>棍度</td>
            </tr>
            <tr v-for="(e, i) of form.detailList" :key="e.index">
              <td><el-input v-model="e.shyjbh" @keydown.native="handleKeyDown($event, i + 1, 0)" :ref="`${i + 1}_0`" /></td>
              <td>
                <el-input v-model="e.tanldcz1" @blur="computePjtld" @keydown.native="handleKeyDown($event, i + 1, 1)" :ref="`${i + 1}_1`" />
              </td>
              <td><el-input v-model="e.tanldcz2" @blur="computePjtld" @keydown.native="handleKeyDown($event, i + 1, 2)" :ref="`${i + 1}_2`" /></td>
              <td>{{ e.tanldpjz }}</td>
              <td><el-input v-model="e.kuozdcdz1" @blur="computePjkzd" @keydown.native="handleKeyDown($event, i + 1, 3)" :ref="`${i + 1}_3`" /></td>
              <td><el-input v-model="e.kuozdcdzz2" @blur="computePjkzd" @keydown.native="handleKeyDown($event, i + 1, 4)" :ref="`${i + 1}_4`" /></td>
              <td>{{ e.kuozdpjz }}</td>
              <td><el-input v-model="e.baosx" @keydown.native="handleKeyDown($event, i + 1, 5)" :ref="`${i + 1}_5`" /></td>
              <td><el-input v-model="e.hansqk" @keydown.native="handleKeyDown($event, i + 1, 6)" :ref="`${i + 1}_6`" /></td>
              <td><el-input v-model="e.nianjx" @keydown.native="handleKeyDown($event, i + 1, 7)" :ref="`${i + 1}_7`" /></td>
              <td><el-input v-model="e.gund" @keydown.native="handleKeyDown($event, i + 1, 8)" :ref="`${i + 1}_8`" /></td>
            </tr>

            <tr trindex="4">
              <td width="100%" colspan="11" height="30">稠度（维勃仪）</td>
            </tr>
            <tr trindex="5">
              <td colspan="2" rowspan="2">试样编号</td>
              <td colspan="6">维勃稠度测值（s）</td>
              <td colspan="3" rowspan="2">维勃稠度平均值（s）</td>
            </tr>
            <tr trindex="5">
              <td colspan="3">1</td>
              <td colspan="3">2</td>
            </tr>
            <tr trindex="6">
              <td colspan="2"><el-input type="Number" style="text-align: center" v-model="form.choudsjbh1" @keydown.native="handleKeyDown($event, 5, 0)" :ref="'5_0'" /></td>
              <td colspan="3"><el-input type="Number" style="text-align: center" v-model="form.weibcdczbh11" @blur="computeCd1" @keydown.native="handleKeyDown($event, 5, 1)" :ref="'5_1'" /></td>
              <td colspan="3"><el-input type="Number" style="text-align: center" v-model="form.weibcdczbh12" @blur="computeCd1" @keydown.native="handleKeyDown($event, 5, 2)" :ref="'5_2'" /></td>
              <td colspan="4">{{ form.weibcdczbh1pjz }}</td>
            </tr>
            <tr trindex="6">
              <td colspan="2"><el-input type="Number" style="text-align: center" v-model="form.choudsjbh2" @keydown.native="handleKeyDown($event, 6, 0)" :ref="'6_0'" /></td>
              <td colspan="3"><el-input type="Number" v-model="form.weibcdczbh21" @blur="computeCd2" @keydown.native="handleKeyDown($event, 6, 1)" :ref="'6_1'" /></td>
              <td colspan="3"><el-input type="Number" v-model="form.weibcdczbh22" @blur="computeCd2" @keydown.native="handleKeyDown($event, 6, 2)" :ref="'6_2'" /></td>
              <td colspan="4">{{ form.weibcdczbh2pjz }}</td>
            </tr>

            <tr trindex="8">
              <td width="100%" colspan="11" height="30">拌和物表观密度</td>
            </tr>
            <tr trindex="9">
              <td colspan="5">试验次数</td>
              <td colspan="2">1</td>
              <td colspan="2">2</td>
              <td colspan="2">3</td>
            </tr>
            <tr trindex="9">
              <td colspan="5">试样筒质量（kg）</td>
              <td><el-input type="Number" v-model="form.shiytzl1" @blur="computeshiyzl(1)" @keydown.native="handleKeyDown($event, 7, 0)" :ref="'7_0'" /></td>
              <td><el-input type="Number" v-model="form.shiytzl2" @blur="computeshiyzl(2)" @keydown.native="handleKeyDown($event, 7, 1)" :ref="'7_1'" /></td>
              <td><el-input type="Number" v-model="form.shiytzl3" @blur="computeshiyzl(3)" @keydown.native="handleKeyDown($event, 7, 2)" :ref="'7_2'" /></td>
              <td><el-input type="Number" v-model="form.shiytzl4" @blur="computeshiyzl(4)" @keydown.native="handleKeyDown($event, 7, 3)" :ref="'7_3'" /></td>
              <td><el-input type="Number" v-model="form.shiytzl5" @blur="computeshiyzl(5)" @keydown.native="handleKeyDown($event, 7, 4)" :ref="'7_4'" /></td>
              <td><el-input type="Number" v-model="form.shiytzl6" @blur="computeshiyzl(6)" @keydown.native="handleKeyDown($event, 7, 5)" :ref="'7_5'" /></td>
            </tr>
            <tr trindex="9">
              <td colspan="5">振实或捣实后混凝土和试样筒总质量（kg）</td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl1" @blur="computeshiyzl(1)" @keydown.native="handleKeyDown($event, 8, 0)" :ref="'8_0'" /></td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl2" @blur="computeshiyzl(2)" @keydown.native="handleKeyDown($event, 8, 1)" :ref="'8_1'" /></td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl3" @blur="computeshiyzl(3)" @keydown.native="handleKeyDown($event, 8, 2)" :ref="'8_2'" /></td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl4" @blur="computeshiyzl(4)" @keydown.native="handleKeyDown($event, 8, 3)" :ref="'8_3'" /></td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl5" @blur="computeshiyzl(5)" @keydown.native="handleKeyDown($event, 8, 4)" :ref="'8_4'" /></td>
              <td><el-input type="Number" v-model="form.hunnthsytzzl6" @blur="computeshiyzl(6)" @keydown.native="handleKeyDown($event, 8, 5)" :ref="'8_5'" /></td>
            </tr>
            <tr trindex="9">
              <td colspan="5">试样质量（kg）</td>
              <td>
                <span>{{ form.shiyzl1 }}</span>
              </td>
              <td>
                <span>{{ form.shiyzl2 }}</span>
              </td>
              <td>
                <span>{{ form.shiyzl3 }}</span>
              </td>
              <td>
                <span>{{ form.shiyzl4 }}</span>
              </td>
              <td>
                <span>{{ form.shiyzl5 }}</span>
              </td>
              <td>
                <span>{{ form.shiyzl6 }}</span>
              </td>
            </tr>
            <tr trindex="9">
              <td colspan="5">试样筒容积（L）</td>
              <td><span>5</span></td>
              <td><span>5</span></td>
              <td><span>5</span></td>
              <td><span>5</span></td>
              <td><span>5</span></td>
              <td><span>5</span></td>
            </tr>
            <tr trindex="9">
              <td colspan="5">表观密度（kg/m<sup>3</sup>）</td>
              <td>
                <span>{{ form.biaogmd1 }}</span>
              </td>
              <td>
                <span>{{ form.biaogmd2 }}</span>
              </td>
              <td>
                <span>{{ form.biaogmd3 }}</span>
              </td>
              <td>
                <span>{{ form.biaogmd4 }}</span>
              </td>
              <td>
                <span>{{ form.biaogmd5 }}</span>
              </td>
              <td>
                <span>{{ form.biaogmd6 }}</span>
              </td>
            </tr>
            <tr trindex="9">
              <td colspan="5">表观密度平均值（kg/m<sup>3</sup>）</td>
              <td colspan="2">{{ form.biaogmdpjz1 }}</td>
              <td colspan="2">{{ form.biaogmdpjz2 }}</td>
              <td colspan="2">{{ form.biaogmdpjz3 }}</td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="30px" class="bottom-table">
          <tbody>
            <tr>
              <td>
                <el-input :rows="2" type="textarea" v-model="fjsm" @focus="handleFocus('fjsm')" />
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">记录：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">审批：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block; margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType" />
    <bs-judge-base-edit-view ref="bsJudgeBaseEditViewRef" @submit="selectJudgeBaseEdit" :syType="syType" />
  </div>
</template>

<script>
import { getSnhntCdbgmdBsInfo } from "@/api/reportsnhnt/snhntCdbgmdBsInfo";
import { emptyConvert, handleFocus, handleKeyDown } from "@/views/reportForms/utils";
import decimal from "@/utils/big-decimal";

import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import { computeBiQualification } from "@/api/sycs/biQualification";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BsJudgeBaseEditView from "@/views/sycs/bsJudgeBase/BsJudgeBaseEditView.vue";
export default {
  name: "bhw",
  components: {
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseView,
    BsJudgeBaseEditView
  },
  data() {
    return {
      jilbh: "",
      form: {
        shiyrq: "2024年03月09日",
        gongcbwyt: "",
        jilbh: "",
        jiancdwmc: "山东路桥集团试验检测中心有限公司泰安高速公路施工总承包项目工地试验室",
        totalPage: "",
        page: "",
        jiancyj: "",
        zhuyyqsbmcjbh: "",
        gongcmc: "汾阳至石楼高速公路",
        yangpmc: "K39+820-K40+440原地面",
        yangpbh: "JTG/T 3610-2019",
        laiysj: "2022年03月09日",
        yangpsl: "3kg",
        yangpzt: "完好无损"
      },

      fjsm: "附加声明：",
      dateText: "2024年05月10日",
      readonly: false
    };
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    isPdf: {
      type: Boolean,
      default: () => false
    }
  },
  watch: {},
  created() {
    this.getInfo();
  },
  methods: {
    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    // 获取详情
    getInfo() {
      // if (!this.excelId) {
      //   return;
      // }

      getSnhntCdbgmdBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
      });
    },

    submitForm() {
      return this.form;
    },
    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      // this.$set(this.form, 'jiancyj', info.label);
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    //保水率平均值
    handlebaoslpj(e) {
      if (e.baosl1 && e.baosl2) {
        this.baoslpj = ((parseFloat(e.baosl1) + parseFloat(e.baosl2)) / 2).toFixed(1);
      }
    },

    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
      if (!info || !info.label) {
        return;
      }
      if (!this.form.pandyj) {
        this.form.pandyj = info.label;
      } else {
        if (info && info.label) {
          this.form.pandyj += "、" + info.label;
        }
      }
      // 添加指标 info.list
      let keys = [];
      info.list.forEach((item) => {
       if (this.form.baDetailVos[item.refQualId] && this.form.baDetailVos[item.refQualId].jiancjg) {
          this.form.baDetailVos[item.refQualId].symbolValue = item.symbolValue;
          this.form.baDetailVos[item.refQualId].num1 = item.num1;
          this.form.baDetailVos[item.refQualId].num2 = item.num2;
          keys.push(item.refQualId);
        }
      });
      this.computeDetectionResult(keys);
    },
    // 计算检测结果
    computeDetectionResult(keys) {
      if (!keys || keys.length <= 0) {
        return;
      }
      const data = keys.map((key) => {
        const info = {
          ...this.form.baDetailVos[key],
          jiancjg: this.form.baDetailVos[key].jiancjg == "-" ? "" : this.form.baDetailVos[key].jiancjg
        };
        return info;
      });
      computeBiQualification(data).then((res) => {
        const returnData = res.data;
        returnData.forEach((item) => {
          if (!item.symbolValue && !item.num1 && !item.num2) {
            item.jiszb = "-";
          }
          item.jiancjg = item.jiancjg ? item.jiancjg : "-";
          this.form.baDetailVos[item.qualId] = item;
        });
      });
    },
    // 获取检测结论
    getJcjl() {
      const form = JSON.parse(JSON.stringify(this.form));
      queryJcjl(emptyConvert(form)).then((res) => {
        const info = res.data;
        this.form.jiancjl = info.jiancjl;
      });
    },
    // 编辑单个技术指标后赋值
    selectJudgeBaseEdit(info) {
      if (info.qualId) {
        this.form.baDetailVos[info.qualId] = info;
      }
      this.computeDetectionResult([info.qualId]);
    },

    //计算平均坍落度
    computePjtld() {
      if (this.form.detailList) {
        this.form.detailList.forEach((e) => {
          if (e.tanldcz1 && e.tanldcz2) {
            let pjz = decimal.divide(decimal.add(e.tanldcz1, e.tanldcz2, 9), 2);
            e.tanldpjz = decimal.round(pjz, 0);
          } else {
            e.tanldpjz = null;
          }
        });
      }
    },

    //计算平均扩展度；
    computePjkzd() {
      if (this.form.detailList) {
        this.form.detailList.forEach((e) => {
          if (e.kuozdcdz1 && e.kuozdcdzz2) {
            e.kuozdpjz = decimal.divide(decimal.add(e.kuozdcdz1, e.kuozdcdzz2, 9), 2);
          } else {
            e.kuozdpjz = null;
          }
        });
      }
    },

    //计算稠度平均值
    computeCd1() {
      if (this.form.weibcdczbh11 && this.form.weibcdczbh12) {
        this.form.weibcdczbh1pjz = decimal.divide(decimal.add(this.form.weibcdczbh11, this.form.weibcdczbh12, 9), 2);
      }
    },
    //计算稠度平均值
    computeCd2() {
      if (this.form.weibcdczbh21 && this.form.weibcdczbh22) {
        this.form.weibcdczbh2pjz = decimal.divide(decimal.add(this.form.weibcdczbh21, this.form.weibcdczbh22, 9), 2);
      }
    },

    //计算试样质量
    computeshiyzl(i) {
      if (this.form["shiytzl" + i] && this.form["hunnthsytzzl" + i]) {
        let jg = decimal.subtract(this.form["hunnthsytzzl" + i], this.form["shiytzl" + i]);
        this.form["shiyzl" + i] = decimal.round(jg, 0);
      } else {
        this.form["shiyzl" + i] = null;
      }
      //计算表观密度
      if (this.form["shiyzl" + i]) {
        let jg = decimal.divide(decimal.multiply(1000, this.form["shiyzl" + i]), 5, 1);
        this.form["biaogmd" + i] = decimal.round(jg, 0);
      } else {
        this.form["biaogmd" + i] = null;
      }
      //计算表观密度平均值；
      if (this.form.biaogmd1 && this.form.biaogmd2) {
        this.form.biaogmdpjz1 = decimal.divide(decimal.add(this.form.biaogmd1, this.form.biaogmd2), 2, 1);
      } else {
        this.form.biaogmdpjz1 = null;
      }
      if (this.form.biaogmd3 && this.form.biaogmd4) {
        this.form.biaogmdpjz2 = decimal.divide(decimal.add(this.form.biaogmd3, this.form.biaogmd4), 2, 1);
      } else {
        this.form.biaogmdpjz2 = null;
      }
      if (this.form.biaogmd5 && this.form.biaogmd6) {
        this.form.biaogmdpjz3 = decimal.divide(decimal.add(this.form.biaogmd5, this.form.biaogmd6), 2, 1);
      } else {
        this.form.biaogmdpjz3 = null;
      }
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [0, 8, 8, 8, 8, 2, 2, 5, 5];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]?.length) {
        this.$refs[ref][0].focus();
      } else if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>

<style scoped lang="scss">
</style>
